<!doctype>
<html>

<head>
    <title>programmatic_events</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>
    <div>
        <div id="overlay">
            Press here!
        </div>
        <object type="application/x-shockwave-flash" data="test.swf" width="100" height="100" id="objectElement"></object>
    </div>

    <script>
        document.getElementById("overlay").addEventListener("click", (evt) => {
            const object = document.getElementById("objectElement");
            object.focus();
            object.dispatchEvent(new KeyboardEvent("keydown", {
                key: "ArrowRight", code: "ArrowRight", keyCode: 39, bubbles: true,
            }));
        });
    </script>

    <input type="text" id="inputElement"/>
</body>

</html>
